﻿using System;

namespace ConverterSystems.ServiceModel
{
    public class DataChangeFilters
    {
        /// <summary>
        /// 'Stream' provides the least filtering. Every sample is delivered.
        /// </summary>
        public const string Stream = @"<DataChangeFilter xmlns=""http://opcfoundation.org/UA/2008/02/Types.xsd""><Trigger>StatusValueTimestamp_2</Trigger><DeadbandType>0</DeadbandType><DeadbandValue>0</DeadbandValue></DataChangeFilter>";

        /// <summary>
        /// 'Default' provides the standard filtering. Every value change is delivered.
        /// </summary>
        public const string Default = @"<DataChangeFilter xmlns=""http://opcfoundation.org/UA/2008/02/Types.xsd""><Trigger>StatusValue_1</Trigger><DeadbandType>0</DeadbandType><DeadbandValue>0</DeadbandValue></DataChangeFilter>";
    }

    public class EventFilters
    {
        /// <summary>
        /// 'Minimal' delivers only 'Time' and 'Message'.
        /// </summary>
        public const string Minimal = @"<EventFilter xmlns=""http://opcfoundation.org/UA/2008/02/Types.xsd""><SelectClauses>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>Time</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>Message</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"</SelectClauses><WhereClause><Elements /></WhereClause></EventFilter>";

        /// <summary>
        /// 'BaseEventFields' delivers all fields of the 'BaseEventType'.
        /// 'EventId','EventType','SourceNode','SourceName','Time','ReceiveTime','LocalTime','Message','Severity'
        /// </summary>
        public const string BaseEventFields = @"<EventFilter xmlns=""http://opcfoundation.org/UA/2008/02/Types.xsd""><SelectClauses>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>EventId</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>EventType</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>SourceNode</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>SourceName</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>Time</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>ReceiveTime</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>LocalTime</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>Message</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"<SimpleAttributeOperand><TypeDefinitionId><Identifier>i=2041</Identifier></TypeDefinitionId><BrowsePath><QualifiedName><NamespaceIndex>0</NamespaceIndex><Name>Severity</Name></QualifiedName></BrowsePath><AttributeId>13</AttributeId></SimpleAttributeOperand>" +
            @"</SelectClauses><WhereClause><Elements /></WhereClause></EventFilter>";
    }
}